<link href="<?php echo STYLE_PATH_F?>shop/cart.css" rel="stylesheet" type="text/css" />

<form method="post" action="?u=cshop\cart-forder" onSubmit="return sm(this);">
<div class="box-i">
<div class="b-h has-a"><h2 class="fl-l">收货地址</h2> <a id="btn_add_addre" class="cur-p icon-16-new">增加</a></div>
<div id="adddress_list"></div>
</div>

<div class="box-i">
<table width="100%" class="ta-h box-i">
  <caption class="b-h"><h2>商品清单</h2></caption>
  <thead>
    <tr>
      <th>名称</th>
      <th width="80">数量</th>
      <th width="80">金额</th>
    </tr>
  </thead>
  <tbody>
    <?php $sm=0;$s_ids='';foreach($res as $v){ $sm +=$v['money']; $s_ids .=','. $v['id']?>
    <tr>
      <td><a href="<?php echo url::g('u=cgoods\v&id='. $v['data_id'])?>" target="_blank"><?php e_h($v['name'])?></a></td>
      <td><?php echo $v['num']?></td>
      <td class="txt-a-r"><?php echo $v['money']?></td>
    </tr>
    <?php }?>
  </tbody>
</table>

<div class="font-big">留言：<input type="text" name="note" /></div>

<?php $fee = $sm<$expre['free_money'] ? $expre['fee'] : 0; 
$sm +=$fee;
if($fee){?>
<div class="txt-a-r box-p">运费：<?php echo $fee?> &nbsp; </div>
<?php }?>

<div class="box-i txt-a-r">
 合计：<b class="price" data-GM="<?php echo $sm;?>">￥<?php echo $sm;?></b> &nbsp;
 <button class="submit" id="btn_sum" type="submit">确定下单</button>
 <input type="hidden" name="c_ids" value="<?php echo $s_ids;?>" />
</div>
</form>

<script>
function sm(f){
  if (!f.elements['u_address'] || !f.elements['u_address'].value){
	alert('请选择收货地址');
	return false;
  }
  return CheckForm(f);
}
function gUAddre(){
  ajaxUpDiv('#adddress_list', ROOT_URL+ '?u=cuser\\address-fse', null, function(r){
	  if(r=='')$('#btn_add_addre').click();
  });
}
$('#btn_add_addre').click(function(){
	$.get(ROOT_URL+ '?u=cuser\\address-fpost',null, function(r){TEMP['ClueBoxUserAddre']=box(r,'收货地址', {align:'left',finish:gUAddre});});
});
gUAddre();
</script>
